// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#import "IRTC/IRTCStream.h"
#import "WebRTC/RTCMediaStream.h"
NS_ASSUME_NONNULL_BEGIN
@class IRTCStreamConstraints;
/// This class represent a local stream.<br>这个类代表了一条本地媒体流。
RTC_EXPORT
@interface IRTCLocalStream : IRTCStream
/**
  Create an IRTCLocalStream from given RTCMediaStream.<br>从指定RTCMediaStream创建一条IRTCLocalStream。
  @param source Information about stream's source.<br>关于媒体源的信息。
  @details Please create RTCMediaStream, RTCMediaStreamTrack by the
  RTCPeerConnectionFactory returned by [RTCPeerConnectionFactory
  sharedInstance]. This method is defined in RTCPeerConnectionFactory+IRTC.h.<br>请通过[RTCPeerConnectionFactory sharedInstance]返回的RTCPeerConnectionFactory来创建RTCMediaStream和RTCMediaStreamTrack。
*/
- (instancetype)initWithMediaStream:(RTCMediaStream*)mediaStream
                             source:(IRTCStreamSourceInfo*)source;
/**
  Create an IRTCLocalStream from mic and camera with given constraints.<br>根据指定配置参数从麦克风和摄像头创建一条IRTCLocalStream。
  @param constraints Constraints for creating the stream. The stream will not be
  impacted if changing constraints after it is created.<br>创建媒体流的配置参数。如果在创建完媒体流后改变这个参数，媒体流不会变。
  @return On success, an IRTCLocalStream object. If nil, the outError parameter
  contains an NSError instance describing the problem.<br>如果成功，返回一个IRTCLocalStream对象。如果返回nil(空)，outError会包含问题所在的NSError的实例。
*/
- (instancetype)initWithConstratins:(IRTCStreamConstraints*)constraints
                              error:(NSError**)outError;
/**
  @brief Set a user-defined attribute map.<br>设置用户定义的属性映射集。
  @details Remote user can get attribute map by calling setAttributes:. P2P mode
  does not support setting attributes.<br>远端用户可以用attributes来获取属性映射集。P2P模式不支持自定义的用户属性。
*/
- (void)setAttributes:(NSDictionary<NSString*, NSString*>*)attributes;
@end
NS_ASSUME_NONNULL_END
